<template>
  <div>

    <span class="ft" >课程计划

    <span class="ft" >我的课程

  </span>
    <el-row style="height: 840px;
    marginTop: 50px;marginLeft: 150px;">
      <!--<search-bar></search-bar>-->
      <el-tooltip effect="dark" placement="right"
                  v-for="item in lessons"
                  :key="item.id">
        <p slot="content" style="font-size: 14px;margin-bottom: 6px;">课名：{{item.lessonname}}</p>
        <p slot="content" style="font-size: 13px;margin-bottom: 6px">
          <span>老师：{{item.teachername}}</span>
        </p>
        <p slot="content" style="width: 300px" class="abstract">{{item.info}}</p>
        <el-card style="width: 240px;margin-bottom: 20px;height: 205px;float: left;margin-right: 15px" class="book"
                 bodyStyle="padding:10px" shadow="hover" @click="gotodetil(item.lessonname)">
          <div class="cover">
            <img :src="item.photo" alt="视频图片">

          </div>
          <div class="info">
            <div class="title">
              <a>{{item.lessonname}}</a>
              <el-button type="text" class="button" @click="gotodetail(item.id)">课程详情</el-button>
            </div>
            <div class="author">{{item.teachername}}</div>
          </div>
          <div class="author">{{item.teachername}}</div>
             </el-card>
      </el-tooltip>

      <el-tooltip effect="dark" placement="right"  v-for="(o, index) in messagelist" :key="o" :offset="index > 0 ? 2 : 0">
<!--                  v-for="item in books"-->
<!--                  :key="item.id">-->
        <p slot="content" style="font-size: 14px;margin-bottom: 6px;">{{o.title}}</p>
        <p slot="content" style="font-size: 13px;margin-bottom: 6px">
          <span>{{o.teachername}}</span> /
<!--          <span>{{item.date}}</span> /-->
<!--          <span>{{item.press}}</span>-->
        </p>
        <p slot="content" style="width: 300px" class="abstract">{{o.info}}</p>
        <el-card style="width: 240px;margin-bottom: 20px;height: 205px;float: left;margin-right: 15px;" class="book"
                 bodyStyle="padding:10px" shadow="hover" >
          <div class="cover">
            <img :src="o.photo" alt="视频图片">
          </div>
          <div class="info">
            <div class="title">
              <a href="">{{o.lessonname}}</a>
            </div>
          </div>
          <div class="author">{{o.teachername}}</div>

        </el-card>
      </el-tooltip>



    </el-row>
    </span>

  </div>
</template>

<script>
  export default {
    name: 'CourseDetails',
    data () {
      return {
        lessons: [],
      }
    },
    created () {
    this.getLesson()
  },
    methods:{
      getLesson() {
        this.$axios
          .post('/studentlessons', {
           username:window.sessionStorage.getItem('username')
          })
          .then(successResponse => {
            console.log(successResponse.data)
            this.lessons = successResponse.data

          })
          .catch(failResponse => {
          })
      },
      gotodetail(id){
         window.sessionStorage.setItem('id', id)
          this.$router.replace('/courseDetails')
        }
    }

  }
</script>

<style scoped>
  .cover {
    width: 200px;
    height: 150px;
    margin-bottom: 7px;
    overflow: hidden;
    cursor: pointer;
  }

  img {
    width: 200px;
    height: 150px;
    /*margin: 0 auto;*/
  }

  .title {
    font-size: 14px;
    text-align: left;
  }

  .author {
    color: #333;
    width: 102px;
    font-size: 13px;
    margin-bottom: 6px;
    text-align: left;
  }

  .abstract {
    display: block;
    line-height: 17px;
  }

  a {
    text-decoration: none;
  }

  a:link, a:visited, a:focus {
    color: #3377aa;
  }

  .ft{
    font-style: inherit;
    font-size: 40px;
    padding-right:400px ;
  }
  .cho{
    padding-left:100px ;
  }
</style>
